/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import iface.IManager;
import entity.Category;
import java.util.ArrayList;

/**
 *
 * @author User
 */
public class CategoryManager implements IManager<Category> {

    private Manager manager;
    private ArrayList<Category> categoryList;

    public CategoryManager(Manager manager) {
        categoryList = new ArrayList<Category>();
        this.manager = manager;
    }

    @Override
    public void add(Category obj) {
        this.categoryList.add(obj);
    }

    @Override
    public void remove(Category obj) {
        this.categoryList.remove(obj);
        obj.setStatus(false);
        this.manager.getDisabledCategoryManager().add(obj);
    }

    @Override
    public Category replace(int index, Category obj) {
        return this.categoryList.set(index, obj);
    }

    @Override
    public int size() {
        return this.categoryList.size();
    }

    @Override
    public Category get(int index) {
        return this.categoryList.get(index);
    }
}
